import 'dart:convert';
import 'dart:typed_data';

import 'package:flutter/material.dart';
import 'package:lcapp/basic/local_info.dart';
import 'package:lcapp/routes/route.dart';


class UniLinksJump {
  static String? initialLink;
  static jump(
    String url,
  ) async {
    if (!AsrLocalInfo.isAgreePermission || url == null) {
      return;
    }
    //跳转逻辑
    int? userId = AsrLocalInfo.userId;
    Uri u = Uri.parse(url);
    String shareType = u.queryParameters['shareType'].toString();
    if (userId != null) {
      switch (shareType) {//0 咨询 1 视频 2 现货 3 邀请好友 4 邀请二维码
        case '1':
          int id = int.parse(u.queryParameters['shareId']!);
          Navigator.of(ASRRoute.navigatorKey.currentContext!).pushNamed('MinVideoDetailPage',arguments: {
            'videoId':id
          });
          break;
        case '2':
          int id = int.parse(u.queryParameters['shareId']!);
          Navigator.of(ASRRoute.navigatorKey.currentContext!).pushNamed('XianHuoDetailPage',arguments: id);
          break;
        case '0':
          int id = int.parse(u.queryParameters['shareId']!);
          Navigator.of(ASRRoute.navigatorKey.currentContext!).pushNamed('ZixunDetailPage',arguments: id);
          break;
        default:
      }
    }
  }
}
